package com.stu.exercise.service.impl;

import com.stu.exercise.entity.R;
import com.stu.exercise.mapper.StatisticMapper;
import com.stu.exercise.service.StatisticService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class StatisticServiceImpl implements StatisticService {

    @Autowired
    private StatisticMapper statisticMapper;

    @Override
    public R getInfo() {
        List<Map<String, Object>> orderStatistic = statisticMapper.getOrderStatistic();
        List<Map<String, Object>> shopStatistic = statisticMapper.getShopStatistic();
        List<Map<String, Object>> equipment = statisticMapper.getEquipment();
        Map<String, Object> map = new HashMap<>();
        map.put("order", orderStatistic);
        map.put("shop", shopStatistic);
        map.put("equipment", equipment);
        return R.success(map);
    }

    @Override
    public R getDetail() {
        Map<String, Object> map = statisticMapper.getDetail();
        return R.success(map);
    }
}
